const express = require('express');
const app = express();
const cookieParser = require('cookie-parser')
const config = require('./config/server.config')

const loginRouter = require('./routes/login')
const registerRouter = require('./routes/register')

app.use(express.json());
app.use(express.urlencoded({extended: true}))
app.use(cookieParser())
app.use('/', loginRouter);
app.use('/', registerRouter)

app.get('/', function (req, res) {
    res.send('Hello World!!!');
});

const server = app.listen(config.port, config.host, () => {
    console.log(`yangdian-admin project server start at http://${config.host}:${config.port}`)
});